#pragma once
#include<iostream>
#include<assert.h>
using namespace std;
class Date
{
public:
	friend ostream& operator <<(ostream& out, const Date& d);
	friend istream& operator >>(istream& in, const Date& d);
	Date(int year = 1,int month =1,int day = 1)
	{
		_year = year;
		_month = month;
		_day = day;
	}
	void Print()const;
	int GetMonthDay(int year, int month)
	{
		int daymonth[] = { 0,31,28,31,30,31,30,31,31,31,30,31,30,31 };
		if (month == 2 && (year % 100 == 0 && year % 4 == 0 || year % 400 == 0))
		{
			return 29;
		}
		return daymonth[month];

	}
	bool operator==(const Date& d)const;
	bool operator!=(const Date& d)const;
	bool operator<(const Date& d)const;
	bool operator>(const Date& d)const;
	bool operator>=(const Date& d)const;
	bool operator<=(const Date& d)const;
	Date operator+=(int day);
	Date operator+(int day);
	Date operator-=(int day);
	Date operator-(int day);
	Date& operator++();//++d
	Date operator++(int);//d++
	Date& operator--();//--d;
	Date operator--(int);//d--;
	int operator-(const Date& d)const;
private:
	int _day;
	int _month;
	int _year;
};
ostream& operator <<(ostream& out, const Date& d);
istream& operator >>(istream& in, const Date& d);

